<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>


<!-- start: Main Menu -->
<div id="sidebar-left" class="span2">
    <div class="nav-collapse sidebar-nav">
        <ul class="nav nav-tabs nav-stacked main-menu">

        <c:forEach items="${rightList}" var="parentRight">
            <c:if test="${parentRight.sonRight.size()>0}">
                <li>
                    <a class="dropmenu" href="#">
                        <i class="icon-folder-close-alt"></i>
                        <span class="hidden-tablet">
                            ${parentRight.name}
                        </span>
                        <span class="label label-important">
                            ${parentRight.sonRight.size()}
                        </span>
                    </a>
                    <ul>
                        <c:forEach items="${parentRight.sonRight}" var="sonright">
                            <li>
                                <a class="submenu" href="javascript:void(0)" onclick="toFrame(this)"
                                   data-url="${sonright.url}">
                                    <i class="icon-file-alt"></i>
                                    <span class="hidden-tablet">
                                        ${sonright.name}
                                    </span>
                                </a>
                            </li>
                        </c:forEach>
                    </ul>
                </li>
            </c:if>
            <c:if test="${parentRight.sonRight==null||parentRight.sonRight.size()==0}">
                <li>
                    <a href="javascript:void(0)" onclick="toFrame(this)" data-url="${parentRight.url}">
                        <i class="${parentRight.icon}"></i>
                        <span class="hidden-tablet">
                            ${parentRight.name}
                        </span>
                    </a>
                </li>
            </c:if>
        </c:forEach>
        </ul>
    </div>
</div>
<script>
    function toFrame(obj){
        console.log($(obj).attr("data-url"));
        $("#mainFrame").attr("src",$(obj).attr("data-url"));
    }
</script>